package com.haixiaoke.saas.order.service.impl;

import java.util.List;

import com.haixiaoke.saas.common.utils.DateUtils;
import com.haixiaoke.saas.order.domain.OrderRefundDetails;
import com.haixiaoke.saas.order.mapper.OrderRefundDetailsMapper;
import com.haixiaoke.saas.order.service.IOrderRefundDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单退款详情Service业务层处理
 *
 * @author panda
 * @date 2024-04-19
 */
@Service
public class OrderRefundDetailsServiceImpl implements IOrderRefundDetailsService {
    @Autowired
    private OrderRefundDetailsMapper orderRefundDetailsMapper;

    /**
     * 查询订单退款详情
     *
     * @param id 订单退款详情主键
     * @return 订单退款详情
     */
    @Override
    public OrderRefundDetails selectOrderRefundDetailsById(Long id) {
        return orderRefundDetailsMapper.selectOrderRefundDetailsById(id);
    }

    /**
     * 查询订单退款详情列表
     *
     * @param orderRefundDetails 订单退款详情
     * @return 订单退款详情
     */
    @Override
    public List<OrderRefundDetails> selectOrderRefundDetailsList(OrderRefundDetails orderRefundDetails) {
        return orderRefundDetailsMapper.selectOrderRefundDetailsList(orderRefundDetails);
    }

    /**
     * 新增订单退款详情
     *
     * @param orderRefundDetails 订单退款详情
     * @return 结果
     */
    @Override
    public int insertOrderRefundDetails(OrderRefundDetails orderRefundDetails) {
        orderRefundDetails.setCreateTime(DateUtils.getNowDate());
        return orderRefundDetailsMapper.insertOrderRefundDetails(orderRefundDetails);
    }

    /**
     * 修改订单退款详情
     *
     * @param orderRefundDetails 订单退款详情
     * @return 结果
     */
    @Override
    public int updateOrderRefundDetails(OrderRefundDetails orderRefundDetails) {
        orderRefundDetails.setUpdateTime(DateUtils.getNowDate());
        return orderRefundDetailsMapper.updateOrderRefundDetails(orderRefundDetails);
    }

    /**
     * 批量删除订单退款详情
     *
     * @param ids 需要删除的订单退款详情主键
     * @return 结果
     */
    @Override
    public int deleteOrderRefundDetailsByIds(Long[] ids) {
        return orderRefundDetailsMapper.deleteOrderRefundDetailsByIds(ids);
    }

    /**
     * 删除订单退款详情信息
     *
     * @param id 订单退款详情主键
     * @return 结果
     */
    @Override
    public int deleteOrderRefundDetailsById(Long id) {
        return orderRefundDetailsMapper.deleteOrderRefundDetailsById(id);
    }

    @Override
    public int insertBatchOrderRefundDetails(List<OrderRefundDetails> orderRefundDetailsList) {
        return orderRefundDetailsMapper.insertBatchOrderRefundDetails(orderRefundDetailsList);
    }

    @Override
    public List<OrderRefundDetails> selectOrderRefundDetailsByOrderId(String orderId) {
        return orderRefundDetailsMapper.selectOrderRefundDetailsByOrderId(orderId);
    }

    @Override
    public int updateBatchOrderRefundDetails(List<OrderRefundDetails> refundDetailsList) {
        return orderRefundDetailsMapper.updateBatchOrderRefundDetails(refundDetailsList);
    }

    @Override
    public List<OrderRefundDetails> selectRefundDetailsByOrderIdOrLinkedOrderId(String orderId) {
        return orderRefundDetailsMapper.selectRefundDetailsByOrderIdOrLinkedOrderId(orderId);
    }

    @Override
    public List<OrderRefundDetails> countRefundPriceByRefundType(String orderId) {
        return orderRefundDetailsMapper.countRefundPriceByRefundType(orderId);
    }

    @Override
    public List<OrderRefundDetails> selectOrderRefundDetailsByOrderIdAndRecordId(String orderId, Long recordId) {
        return orderRefundDetailsMapper.selectOrderRefundDetailsByOrderIdAndRecordId(orderId, recordId);
    }

    @Override
    public int deleteOrderRefundDetailsByOrderId(String orderId) {
        return orderRefundDetailsMapper.deleteOrderRefundDetailsByOrderId(orderId);
    }

    @Override
    public List<OrderRefundDetails> selectRefundDetailsByOrderIdOrLinkedOrderIdAndRefundType(String orderId, String refundType) {
        return orderRefundDetailsMapper.selectRefundDetailsByOrderIdOrLinkedOrderIdAndRefundType(orderId, refundType);
    }
}
